<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>7背景半透明</title>
  <style>
    div {
      width: 300px;
      height: 300px;
      background-color: #000;
      background: rgba(0, 0, 0, 0.5);
    }
  </style>
</head>

<body>
  <div> </div>
</body>

</html>